<template>
  <div>
    <eagle-dialog-page
      :url="url"
      :params="paramArr"
      @initList="_initTemplateList"
      @open="open"
      @submit="submit"
      @callbackDialog="callbackDialog"
      @setData="setData"
      v-bind="$attrs"
      v-on="$listeners"
      ref="eagleDialogPage"
      :tab="false"
      :isPage="true"
      :isMulti="true"
      :option="option"
    >
    <div style="display:flex" v-for="dataItem in list" :key="dataItem.CTCode">
      <div style="flex:0.9">
        <eagle-cell
          :title="dataItem.CheckTaskName"
        >
        </eagle-cell>
      </div>
      <div style="display:flex;flex:0.1;align-items: center;justify-content: center;text-align: justify;">
        <eagle-checkbox :name="dataItem.CheckTaskName" shape="round"
        />
      </div>
    </div>
    </eagle-dialog-page>
  </div>
</template>
<script>
export default {
  name: "check-company-choose",
  props: {
    title: {
      type: String,
      default: "选择检查公司",
    },
    confirmButton: {
      type: String,
      default: "完成",
    },
    tagData: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      url: "/DangerCheckTaskJG/GetPageData",
      list: [],
      paramArr: [
        {
          dataType: "NotFinish",
          page: -1,
          limit: 10,
        },
      ],
      selected: this.tagData,
      selecteData: [],
      // option: { name: "CompanyName", code: "CompanyCode" },
      // option: { name: "CheckTaskName", code: "CTCode" },
      option: { name: "CTCode", code: "CheckTaskName" },
    };
  },
  methods: {
    _initTemplateList(list) {
      
      this.list = list;
      this.$refs.eagleDialogPage.initSeletedData(this.selected);
    },
    open(list) {
      console.log("open")
      console.log(list)
      this.list = list;
    },
    submit() {
      this.$refs.eagleDialogPage.submit();
    },
    setData(data) {
      console.log("setData")
      console.log(data)
      this.selected = data;
      // this.$emit("callback2",data);
    },
    callbackDialog() {
      this.$emit("callback", this.selected);
      console.log("callbackDialog")
      console.log(this.selected)
    },
    deleteSelect(code) {
      this.$refs.eagleDialogPage.deleteSelect(code);
    },
  },
};
</script>
<style lang="less" scoped>
.risk_item_radio {
  width: 100%;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  // border-bottom: 1px solid #e8f1f8;
}

.risk_item_buton {
  width: 100%;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>